package main.java.aircraft;

import main.java.controlMediator.AirTrafficControlBaseMediator;

public abstract class Aircraft {

    /**
	 * @uml.property  name="atc"
	 * @uml.associationEnd  
	 */
    private AirTrafficControlBaseMediator atcb;
    /**
	 * @uml.property  name="altitude"
	 */
    private int altitude = 0;

    /**
	 * @uml.property  name="registrationNumber"
	 */
    private String registrationNumber;

	public String getRegistrationNumber() {
		return registrationNumber;
	}

	public void setRegistrationNumber(String registrationNumber) {
		this.registrationNumber = registrationNumber;
	}

	/**
	 * @return
	 * @uml.property  name="altitude"
	 */
	public int getAltitude() {
		return altitude;
	}

	/**
	 * @param alt
	 * @uml.property  name="altitude"
	 */
	public void setAltitude(int alt) {
		altitude = alt;
        atcb.SendWarningMessage(this);
	}
	
	public Aircraft(){}
 
    public Aircraft(String registrationNumber, AirTrafficControlBaseMediator atc)
    {
    	setRegistrationNumber(registrationNumber);
    	atcb = atc;
        atc.RegistrerAircraft(this);
    }

    public int increaseAltitude(double heightToIncrease)
    {
        return altitude += heightToIncrease;
    }

    public void ReceiveWarning(Aircraft reportingAircraft)
    {
        System.out.println("\n\r-----------------------" +
        		"\n\rAir Control Traffic: " + 
        		"Flight number " + this.getRegistrationNumber() + ", " + 
        		"Flight number " + reportingAircraft.getRegistrationNumber() +
        		" is at your flight altitude!! " + 
        		"\n\rAir Control Traffic: Flight number " + reportingAircraft.getRegistrationNumber() +
        		" Change your altitude from " + reportingAircraft.getAltitude() + 
        		" to " + (reportingAircraft.getAltitude() + 1000));
    }
}
